﻿#include "QtCEFApp.h"
#include "QtCEFHandler.h"

#include "include/views/cef_browser_view.h"
#include "include/views/cef_window.h"
#include "include/wrapper/cef_helpers.h"

QtCEFApp::QtCEFApp() {}

void QtCEFApp::OnBeforeCommandLineProcessing(const CefString&          process_type,
                                             CefRefPtr<CefCommandLine> command_line) {
    // 关闭同源策略，允许跨域访问
    command_line->AppendSwitch("--disable-web-security");
    // 也可以在这里添加其它命令行参数
}

void QtCEFApp::OnContextInitialized() {
    CEF_REQUIRE_UI_THREAD();
}

CefRefPtr<CefClient> QtCEFApp::GetDefaultClient() {
    // Called when a new browser window is created via the Chrome runtime UI.
    return QtCEFHandler::GetInstance();
}